package com.zs.source;


import com.zs.source.aop.AopService;
import com.zs.source.config.SpringConfig;
import com.zs.source.service.MapperService;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * @author zhshuo
 * @date 2021/07/09 16:56
 **/
@EnableTransactionManagement
public class SouceApplication {

	public static void main(String[] args) {
		//通过new AnnotationConfigApplicationContext的方式，实例化了ApplicationContext的抽象对象AbstractApplicationContext
		AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(SpringConfig.class);
		/*StudentService studentService = (StudentService) applicationContext.getBean("studentServiceImpl");
		studentService.bookInvoke();

		BookService bookService = (BookService) applicationContext.getBean("bookServiceImpl");
		bookService.price();

		TeacherService teacherService = (TeacherService) applicationContext.getBean("teacherServiceImpl");
		teacherService.teacherInfo();*/

		/*AopService aopService = (AopService) applicationContext.getBean("aopServiceImpl");
		aopService.aopMethod();*/

		MapperService bookService = (MapperService) applicationContext.getBean("mapperServiceImpl");
		bookService.insert();
	}

}
